;; srecode-matlab.srt --- SREcode Templates for MATLAB.

;; Copyright (C) 2008, 2014 Eric Ludlam

;; Author: Eric Ludlam <eludlam@mathworks.com>
;; X-RCS: $Id$

;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
;; published by the Free Software Foundation; either version 2, or (at
;; your option) any later version.

;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
;; General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.


set mode "matlab-mode"
set escape_start "{{"
set escape_end "}}"

context file

set comment_start  "%"
set comment_prefix "%"
set comment_end    ""

;; @todo - add argument support.
;;         choose template based on script/function or class in current dir.
template empty :matlab :file :user :time
"Fill out an empty file."
----
{{#FILE_FUNCTION}}function {{FILE_SYMBOL}}
{{comment_prefix}} {{FILE_DOC_SYMBOL}} - 
{{comment_prefix}}

{{comment_prefix}} Copyright (C) {{YEAR}} {{?AUTHOR}}

  {{^}}

end
{{/FILE_FUNCTION}}{{#FILE_CLASS}}classdef {{FILE_SYMBOL}}
{{comment_prefix}} Class {{FILE_DOC_SYMBOL}}
{{comment_prefix}}

{{comment_prefix}} Copyright (C) {{YEAR}} {{?AUTHOR}}

    properties

    end

    methods
	function h = {{FILE_SYMBOL}}({{^}})
	% Constructor
	   
        end
    end
end

{{/FILE_CLASS}}
end
----
bind "e"


context declaration


prompt NAME "Name for declaration: "

template classdef :time :user :time
"Template to declare a class"
----
classdef {{?NAME}} 
% Class {{NAME:upcase}}
%
% Copyright (C) {{YEAR}} {{?AUTHOR}}

    properties

    end

    methods
	function h = {{NAME}}(varargin)
	    {{^}}
        end
    end
end
----
bind "c"

template function :blank :indent
"Template to declare a function."
----
function {{?NAME}}
    {{^}}
end
----
bind "f"

template variable :blank :indent
"Template to declare a variable."
----
global {{?NAME}}
----
bind "v"

context code

template function :blank :indent
"Nested functions are indented."
----
    function {{?NAME}}
      {{^}}
    end
----
bind "f"

template variable :blank :indent
"Template to declare a variable."
----
    persistent {{?NAME}}
----
bind "v"


;; end